//
//  HomeButton.m
//  ScalperMerchant
//
//  Created by 王云 on 2017/9/29.
//  Copyright © 2017年 WY. All rights reserved.
//

#import "HomeButton.h"

@implementation HomeButton


- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        
        UILabel *numL = [[UILabel alloc] init];
        numL.text = @"0";
        [numL setTextAlignment:NSTextAlignmentCenter];
        numL.font = [UIFont systemFontOfSize:14];
        numL.textColor = KGreenColor;
        [self addSubview:numL];
        _numL = numL;

        UILabel *titleL = [[UILabel alloc] init];
        titleL.text = @"0";
        [titleL setTextAlignment:NSTextAlignmentCenter];
        titleL.font = [UIFont systemFontOfSize:12];
        titleL.textColor = TitleDarkColor;
        [self addSubview:titleL];
        _titleL = titleL;

        UIImageView *lineI = [[UIImageView alloc] init];
        lineI.backgroundColor = DarkColor;
        [self addSubview:lineI];
        
        __weak __typeof(&*self)weakSelf = self;
        [numL mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.with.mas_equalTo(weakSelf);
//            make.height.mas_equalTo(weakSelf.frame.size.height/2);
            make.bottom.equalTo(weakSelf.mas_centerY).offset(-4);
        }];
        [titleL mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.with.mas_equalTo(weakSelf);
            make.top.equalTo(numL.mas_bottom);
            make.height.mas_equalTo(weakSelf.frame.size.height/2);
        }];
        [lineI mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.centerY.mas_equalTo(weakSelf);
            make.height.mas_equalTo(weakSelf.frame.size.height-20);
            make.width.mas_equalTo(@1);
        }];
    }
    return self;
}


@end
